import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '名称',
    align: 'center',
    dataIndex: 'name',
  },
  {
    title: '全称',
    align: 'center',
    dataIndex: 'fullName',
  },
  {
    title: '联系人',
    align: 'center',
    dataIndex: 'contactUser',
  },
  {
    title: '联系人电话',
    align: 'center',
    dataIndex: 'mobile',
  },
  {
    title: '联系人邮箱',
    align: 'center',
    dataIndex: 'email',
  },
  {
    title: '供应商类型',
    align: 'center',
    dataIndex: 'type_dictText',
  },
  {
    title: '范围',
    align: 'center',
    dataIndex: 'scope',
  },
  {
    title: '营业执照',
    align: 'center',
    dataIndex: 'businessLicense',
    customRender: render.renderImage,
  },
  {
    title: '税务登记',
    align: 'center',
    dataIndex: 'taxRegCertificate',
    customRender: render.renderImage,
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '全称',
    field: 'fullName',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '联系人',
    field: 'contactUser',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '联系人电话',
    field: 'mobile',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '联系人邮箱',
    field: 'email',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: '供应商类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'supplier_type',
    },
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '名称',
    field: 'name',
    component: 'Input',
    required: true,
  },
  {
    label: '全称',
    field: 'fullName',
    component: 'Input',
    required: true,
  },
  {
    label: '联系人',
    field: 'contactUser',
    component: 'Input',
    required: true,
  },
  {
    label: '联系人电话',
    field: 'mobile',
    component: 'Input',
    required: true,
  },
  {
    label: '联系人邮箱',
    field: 'email',
    component: 'Input',
    required: true,
  },
  {
    label: '供应商类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'supplier_type',
    },
    required: true,
  },
  {
    label: '范围',
    field: 'scope',
    component: 'Input',
    required: true,
  },
  {
    label: '营业执照',
    field: 'businessLicense',
    component: 'JImageUpload',
    componentProps: {
      fileMax: 0,
    },
    required: true,
  },
  {
    label: '税务登记',
    field: 'taxRegCertificate',
    component: 'JImageUpload',
    componentProps: {
      fileMax: 0,
    },
  },
  {
    label: '供应商类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'supplier_type',
    },
    required: true,
    //colProps: {span: 6},
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  name: { title: '名称', order: 1, view: 'text', type: 'string' },
  fullName: { title: '全称', order: 2, view: 'text', type: 'string' },
  contactUser: { title: '联系人', order: 3, view: 'text', type: 'string' },
  mobile: { title: '联系人电话', order: 4, view: 'text', type: 'string' },
  email: { title: '联系人邮箱', order: 5, view: 'text', type: 'string' },
  type: { title: '供应商类型', order: 6, view: 'text', type: 'string' },
  scope: { title: '范围', order: 7, view: 'text', type: 'string' },
  businessLicense: { title: '营业执照', order: 8, view: 'image', type: 'string' },
  taxRegCertificate: { title: '税务登记', order: 9, view: 'image', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
